package com.help10000.rms.mvp.presenter

import com.amir.common.api.CustomObserver
import com.amir.common.beans.BaseResult
import com.amir.common.mvp.model.Model
import com.amir.common.mvp.presenter.BasePresenter
import com.amir.common.utils.Constant
import com.amir.common.utils.SPUtils
import com.amir.common.utils.ToastUtil
import com.help10000.rms.mvp.view.AddProductView

class AddProductPresenter(view: AddProductView):BasePresenter<AddProductView>(view) {
    fun addProduct(repairId: String?, itemId: Int?, saleQty: String, price: String?, mWareId: String?) {
        val AccessToken = SPUtils.getString(Constant.AccessToken)
        val prodAdd = Model.getServer().ProdAdd(AccessToken, mWareId, repairId, itemId, saleQty, price)
        Model.getObservable(prodAdd,object :CustomObserver<BaseResult>(mvpView){
            override fun success(t: BaseResult) {

            ToastUtil.show("添加成功")
                mvpView?.addSuccess()
            }
        })
    }
}